<?php

class my_training_form_helper extends swap\helper {
    
    public static function run($context) {
        
        $show = false;
        $action = 'my-training/do_new?id=' . $context['id'];
        $return_url = 'my-resume/edit?id=' . $context['id'];
        
        if (isset($context['training_id'])) {
            $show = true;
            $action = array('my-training/do_edit', array('id' => $context['id'], 'training_id' => $context['training_id']));
            $return_url = array('my-training/index?id=' . $context['id']);
            
            $training = training_model::get_by_id($context['training_id']);
            self::set('training', $training);
        }
        
        self::set('id', $context['id']);
        self::set('return_url', $return_url);
        self::set('show', $show);
        self::set('action', $action);
        
        self::render();
    }
    
}